﻿using System;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using Project.IDAO;
using Project.DTO;
using Project.DBMAPPING;
using System.Collections.Generic;

namespace Project.DAO
{
    /// <summary>
    /// Class define method(s) for displaying product list of a specific category
    /// </summary>
    public class ProductListDAO : IProductListDAO
    {
        /// <summary>
        /// Load product list of a specific category
        /// </summary>
        /// <param name="categoryID">Input category ID</param>
        /// <returns>List of products</returns>
        public List<SP_PRODUCT_LOADPRODUCTLISTResult> LoadProductList(int categoryID)
        {
            // Declare variable to access database
            DbMappingDataContext database = new DbMappingDataContext();
            // Return a list of products
            return database.SP_PRODUCT_LOADPRODUCTLIST(categoryID).ToList();
        }
    }
}
